unit uColetorCad;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uPai_new, FMTBcd, DBClient, Provider, DB, SqlExpr, Menus,
  StdCtrls, Buttons, ExtCtrls, MMJPanel, Grids, DBGrids, DBTables;

type
  TfColetorCad = class(TfPai_new)
    DBGrid1: TDBGrid;
    BitBtn1: TBitBtn;
    DataSetProvider1: TDataSetProvider;
    cdsCol: TClientDataSet;
    cdsColCOL_NSERIE: TStringField;
    cdsColCOL_MODELO: TStringField;
    cdsColCOL_NCHAVE: TFMTBCDField;
    cdsColCOL_NPORTA: TFMTBCDField;
    cdsColCOL_LOGUSU: TStringField;
    sdsCol: TSQLDataSet;
    procedure BitBtn1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fColetorCad: TfColetorCad;

implementation

uses udm;

{$R *.dfm}

procedure TfColetorCad.BitBtn1Click(Sender: TObject);
var str:string;
begin
  str := 'UPDATE ATS_COLETOR_CAD SET COL_LOGUSU = NULL, COL_NCHAVE = NULL ' +
    ' WHERE COL_NPORTA = ' + IntToStr(cdsColCOL_NPORTA.AsInteger);
  dm.SQLConnection1.ExecuteDirect(str);
  if (cdsCol.Active) then
    cdsCol.Close;
  cdsCol.Open;
end;

procedure TfColetorCad.FormShow(Sender: TObject);
begin
  //inherited;
  //cdsCol.CommandText := 'SELECT * FROM ATS_COLETOR_CAD';
  cdsCol.Open;
  //table1.Open;
end;

end.
